package rhc.spider.spider;


import rhc.spider.common.SpiderData;
import rhc.spider.crawler.Crawler;
import rhc.spider.request.Request;
import rhc.spider.request.Response;
import rhc.spider.setting.Setting;

/**
 * @author lenovo
 *
 */
abstract public class BasicSpider implements Spider{

	protected Crawler crawler;
	
	protected Setting setting;
	
	public BasicSpider(Crawler crawler,Setting setting){
		this.crawler=crawler;
		this.setting=setting;
	}

	/**默认保存数据的方法每个spider里调用
	 * @param data
	 */
	public final void transData(SpiderData data,Request request,Response response){
		crawler.getEngine().getEngineExecuter().executeSpiderData(this, request, response, data);
	}
	
}
